/*
 * @Author: wwssaabb
 * @Date: 2021-07-14 11:44:26
 * @LastEditTime: 2021-07-14 17:01:22
 * @FilePath: \demo\blog_demo\route\user.js
 */

//当前登录的用户信息

const userList=[

]
let user=null

function setUser(newUser){
  user=newUser
  let oldUser=userList.find(i=>i._id===user._id)
  if(oldUser){
    oldUser=user
  }else{
    userList.push(user)
  }
}

function getUser(){
  return user?user:null
}


module.exports={
  setUser,
  getUser
}